<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ showArr.length }}</strong></span
    >
    <ul class="filters">
      <li>
        <a
          :class="{ selected: getSel === 'all' }"
          href="javascript:;"
          @click="$store.commit('clickFn', 'all')"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: getSel === 'no' }"
          href="javascript:;"
          @click="$store.commit('clickFn', 'no')"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: getSel === 'yes' }"
          href="javascript:;"
          @click="$store.commit('clickFn', 'yes')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="clear">清除已完成</button>
  </footer>
</template>

<script>
import { mapState,mapGetters } from "vuex";
export default {
  computed: {
    ...mapState(["list", "getSel"]),
    ...mapGetters(["showArr"])
  },
  methods: {
    clear() {
      this.$store.commit("clearFn");
    },
  },
};
</script>
